// 微信小程序登录接口
import base from './base.js';

export default {
	...base,

	/* 刷新本地用户 */
	reload() {
		let that = this;
		return new Promise((resolve, reject) => {
			uni.login({
				provider: 'weixin',
				success: function(loginRes) {
					that.vm.$u.post('data/api.wxapp/session', {
						code: loginRes.authCode
					}).then(ret => {
						if (ret.code) {
							that.update(ret.data);
							resolve(ret.data);
						} else {
							reject(ret.info)
						}
					});
				}
			});
		});
	},
}
